home *** CD-ROM | disk | FTP | other *** search
/ Total Web Page (Professional Suite) / Total Web Page 99.iso / Javascripts / navigation / linker_.txt < prev    next >
Text File  |  1998-10-30  |  3KB  |  74 lines

  1. <HEAD>
  2. <TITLE>Links</TITLE>
  3. <script language="JavaScript">
  4. <!--
  5. /* script by Colm Mac Cßrthaigh colmmacc@geocities.com
  6.  * VERSION 3
  7.  * fairly easy to customise, mereley change the startPage and endPage to your requirements.
  8.  * changes in version 3 - alert if no links selected, now works with IE4, fixed external Form bug
  9.  * be sure to read all notes at side of script
  10.  * you are free to use this script as long as you include this message
  11.  * it would be nice to get an E-Mail form anyone who uses this script, but it's not obligatory
  12.  * please e-mail me with any problems also    
  13.  */
  14.  
  15. function newlink(href, descr) {
  16. document.write ('<FORM><INPUT TYPE="checkbox" NAME="picklink" VALUE="off"><a href="' + href +'">' + href + '</a><br>' + descr +'<INPUT TYPE=HIDDEN NAME="site" VALUE="' + href + '"><INPUT TYPE=HIDDEN NAME="desc" VALUE="' + descr +'"></FORM>');
  17. }
  18.  
  19. function makepage () {
  20.  
  21. startPage = '<HTML><HEAD><TITLE>Links:</TITLE></HEAD>' +
  22.           '<BODY TEXT="#000000" LINK="#0000ff" VLINK="#008800" BGCOLOR="#ffffff">' +
  23.           '<h1><center>Your Links<hr noshade color="#880000"></center></h1>'; 
  24.  
  25. linkPage = startPage
  26.  
  27. n = (document.forms.length - 0) // replace 0 with number of extenal forms on page(i.e. the number of FORM tags on the page) 
  28.  
  29. for (var i = 0; i < n; i++) {
  30. if (document.forms[i].picklink.checked == true) {
  31.     var site = document.forms[i].site.value;
  32.     var desc = document.forms[i].desc.value;
  33.     link = '<a href="' + site + '" target="opener">' + site + '</a><br>' + desc + '<br><br>';
  34.     linkPage = linkPage + link
  35.     }
  36. }
  37.  
  38. if (linkPage == startPage){
  39.     alert('You did not mark any links - please mark some and start again')
  40.     }
  41. else{
  42.  
  43.     endPage = '<hr noshade color="#880000"><center><h2><a href="http://www.yoururl.com/">The site you just came from</a></h2></BODY></HTML>'; // make sure you put a url and reference in here(to your own site!)
  44.  
  45.     linkPage = linkPage + endPage
  46.  
  47.     remote = window.open("","remotewin","width=350,height=400,scrollbars=yes");
  48.     
  49.     browserver = navigator.userAgent
  50.     if (browserver.indexOf("MSIE") != -1){
  51.     remote.location = 'javascript:opener.linkPage';
  52.     }
  53.     else {
  54.     remote.document.write (linkPage);
  55.     remote.document.close()
  56.     } 
  57.       if (remote.opener == null) remote.opener = window; 
  58.        remote.opener.name = "opener";
  59.     }
  60. }
  61. //-->
  62. </script>
  63. </HEAD>
  64. <BODY TEXT="#000000" LINK="#0000ff" VLINK="#008800" BGCOLOR="#ffffff">
  65. Put a check next to the links that take your interest and click go!<br><br>
  66. <script>
  67. <!--
  68. newlink ("http://www.yahoo.com/", "Yahoo") // first field is link, second field is text n.b. this will appear in both windows
  69. newlink ("http://www.infoseek.com/", "Infoseek")
  70. newlink ("http://www.excite.com/", "Excite")
  71. newlink ("http://www.lycos.com/", "Lycos")
  72. //-->
  73. </SCRIPT>
  74. <a href="javascript:makepage()">Go!</a>